-------------------- EDIT VIEW  ---------------

------------------- DATABASE-VIEW: EDIT VIEW  ---------------
if (object_id('vwCallback_View') is not null)
drop view [dbo].vwCallback_View
go
CREATE VIEW [dbo].vwCallback_View
AS
SELECT [ID]
      ,[CreatedTime]
      ,[CallingPhoneNumber]
      ,[CallbackPhoneNumber]
      ,[SysStatus]
      ,[Status]
      ,[Result]
      ,[AgentID]
      ,[Station]
      ,[MessageUrl]
      ,[Tries]
      ,[TelephonyPort]
      ,[LastUpdateTime]
      ,[Note]
  FROM [dbo].[Callbacks] 
go
	---------- INSERT EDIT VIEW -------

delete DETAILVIEWS where id='9CC035E8-9898-4869-A0C6-5E2D017BCCF3'
go
INSERT INTO [dbo].[DETAILVIEWS]
           ([ID]
           ,[DELETED]
           ,[DATE_ENTERED]
           ,[DATE_MODIFIED]
           ,[DATE_MODIFIED_UTC]
           ,[NAME]
           ,[MODULE_NAME]
           ,[VIEW_NAME]
           ,[LABEL_WIDTH]
           ,[FIELD_WIDTH]
           ,[DATA_COLUMNS]
           )
     VALUES
           ('9CC035E8-9898-4869-A0C6-5E2D017BCCF3'
           ,0
           ,getdate()
           ,getdate()
           ,getdate()
           ,'Callback.DetailView'
           ,'Callback'
           ,'vwCallback_View'
           ,'15%'
           ,'35%'
           ,2
           )
GO
---------- INSERT FIELD : [CallingPhoneNumber] -------
DELETE DETAILVIEWS_FIELDS WHERE [DETAIL_NAME]= 'Callback.DetailView'
go
	--select newid()
INSERT INTO [dbo].[DETAILVIEWS_FIELDS]([ID],[DELETED],[CREATED_BY],[DATE_ENTERED],[MODIFIED_USER_ID],[DATE_MODIFIED],[DATE_MODIFIED_UTC],[DETAIL_NAME],[FIELD_INDEX],[FIELD_TYPE],[DEFAULT_VIEW],[DATA_LABEL],[DATA_FIELD],[DATA_FORMAT])
SELECT newid(),0,null,getdate(),null,getdate(),getdate(),'Callback.DetailView',1,'String',0,'Callback.LNK_CALLBACK_LIST_CallingPhoneNumber','CallingPhoneNumber','{0}' union all
SELECT newid(),0,null,getdate(),null,getdate(),getdate(),'Callback.DetailView',2,'String',0,'Callback.LNK_CALLBACK_LIST_CallbackPhoneNumber','CallbackPhoneNumber','{0}' union all
SELECT newid(),0,null,getdate(),null,getdate(),getdate(),'Callback.DetailView',3,'String',0,'Callback.LNK_CALLBACK_LIST_CreatedTime','CreatedTime','{0}' union all
SELECT newid(),0,null,getdate(),null,getdate(),getdate(),'Callback.DetailView',4,'String',0,'Callback.LNK_CALLBACK_LIST_SysStatus','SysStatus','{0}' union all
SELECT newid(),0,null,getdate(),null,getdate(),getdate(),'Callback.DetailView',5,'String',0,'Callback.LNK_CALLBACK_LIST_Status','Status','{0}' union all
SELECT newid(),0,null,getdate(),null,getdate(),getdate(),'Callback.DetailView',6,'String',0,'Callback.LNK_CALLBACK_LIST_Result','Result','{0}' union all
SELECT newid(),0,null,getdate(),null,getdate(),getdate(),'Callback.DetailView',7,'String',0,'Callback.LNK_CALLBACK_LIST_AgentID','AgentID','{0}' union all
SELECT newid(),0,null,getdate(),null,getdate(),getdate(),'Callback.DetailView',8,'String',0,'Callback.LNK_CALLBACK_LIST_Station','Station','{0}' union all
SELECT newid(),0,null,getdate(),null,getdate(),getdate(),'Callback.DetailView',9,'String',0,'Callback.LNK_CALLBACK_LIST_MessageUrl','MessageUrl','{0}' union all
SELECT newid(),0,null,getdate(),null,getdate(),getdate(),'Callback.DetailView',0,'String',0,'Callback.LNK_CALLBACK_LIST_Tries','Tries','{0}' union all
SELECT newid(),0,null,getdate(),null,getdate(),getdate(),'Callback.DetailView',11,'String',0,'Callback.LNK_CALLBACK_LIST_TelephonyPort','TelephonyPort','{0}' union all
SELECT newid(),0,null,getdate(),null,getdate(),getdate(),'Callback.DetailView',12,'String',0,'Callback.LNK_CALLBACK_LIST_LastUpdateTime','LastUpdateTime','{0}' union all
SELECT newid(),0,null,getdate(),null,getdate(),getdate(),'Callback.DetailView',13,'String',0,'Callback.LNK_CALLBACK_LIST_Note','Note','{0}'
